package com.lm.orika.controller;

import com.lm.orika.dto.UserDTO;
import com.lm.orika.entry.UserEntity;
import ma.glasnost.orika.MapperFacade;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/orika")
public class OrikaController {
    @Resource
    private MapperFacade mapper;

    @RequestMapping("/dto")
    public String dto(@RequestBody UserDTO dto){
        mapper.map(dto, UserEntity.class);
        System.out.println(dto);
        return "data";
    }
}
